<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
</head>
<body>
<button id="js2java">js调用java</button><br>
<script>
document.querySelector("#js2java").addEventListener("click",function(){

    console.log(prompt("toast|asdqwe"));
});
</script>
</body>
</html>